<script setup>

import ListingsList from "./component/listingsList.vue";
import Sift from "./component/sift.vue";
import {ref} from "vue";

const name = ref()

const onClickLeft = () => {
  history.back()
}//导航栏返回上一个页面

const reload = ref(true)
const params = ref({})

const onSearch = () => {
  params.value.keywords = name.value
  reload.value = !reload.value
}

// 获取查询参数
const getParams = (data) => {
  reload.value = !reload.value
  params.value = data.value
}
</script>

<template>
  <div style="width: 100vw;height: 100vh">
    <van-search
        :focus="true"
        v-model="name"
        placeholder="请输入搜索关键词"
        show-action
        @search="onSearch"
        @cancel="onClickLeft"
        style="
          width: 100%;
          "
    />
    <sift style="width: 100%" @close="getParams"/>
    <listingsList :key="JSON.stringify(reload)" url="listings/selectByCityAll" :params="params"></listingsList>
  </div>
</template>

<style scoped>

</style>